FROM centos:6.6
MAINTAINER  571288304@qq.com
RUN yum install -y vsftpd db4-utils
RUN useradd virftp -s /sbin/nologin
ADD vsftpd_login /etc/vsftpd/
RUN chmod 600 /etc/vsftpd/vsftpd_login
RUN db_load -T -t hash -f /etc/vsftpd/vsftpd_login /etc/vsftpd/vsftpd_login.db
RUN mkdir  /etc/vsftpd/vsftpd_user_conf
ADD test1 /etc/vsftpd/vsftpd_user_conf/
RUN mkdir /home/virftp/test1
RUN chown -R virftp:virftp /home/virftp
RUN echo "auth sufficient /lib64/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login" >>/etc/pam.d/vsftpd
RUN echo "account sufficient /lib64/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login" >> /etc/pam.d/vsftpd
RUN sed -i s/anonymous_enable=YES/anonymous_enable=NO/g /etc/vsftpd/vsftpd.conf
RUN sed -i s/#anon_upload_enable=YES/anon_upload_enable=NO/g /etc/vsftpd/vsftpd.conf
RUN sed -i s/#anon_mkdir_write_enable=YES/anon_mkdir_write_enable=NO/g /etc/vsftpd/vsftpd.conf
RUN echo "chroot_local_user=YES" >>/etc/vsftpd/vsftpd.conf
RUN echo "guest_enable=YES" >> /etc/vsftpd/vsftpd.conf
RUN echo "guest_username=virftp" >> /etc/vsftpd/vsftpd.conf
RUN echo "virtual_use_local_privs=YES" >> /etc/vsftpd/vsftpd.conf
RUN echo "user_config_dir=/etc/vsftpd/vsftpd_user_conf" >> /etc/vsftpd/vsftpd.conf
#EXPOSE 21
ADD vsftp.sh /usr/local/
RUN chmod 757 /usr/local/vsftp.sh
ENTRYPOINT ["/usr/local/vsftp.sh"]
CMD ["start"] 
